<?php
class DefaultController extends FrontEndController
{
    public function actionIndex($url)
    {
        $this->render('index',array(
                'model'=>$this->loadPage($url),
        ));
    }

    public function loadPage($url){
        $language = Language::getIdForLang(Yii::app()->language);
        //Выбераем ту страницу каторую запрашивает браузер
        $model = Yii::app()->db->createCommand()
            ->select('*')
            ->from('Page')
            ->where('url=:url AND lang_id=:language',array(':url'=>$url,':language'=>$language))
            ->queryRow();
        if($model==null)
            throw new CHttpException(404,'The requested page does not exist.');
        return $model;
    }
}